package negModel;

import java.util.*;

public class ListaDePartes implements List{

	ArrayList v;
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private boolean tienePartes(Collection arg0){
		
		Iterator iter = arg0.iterator();
		boolean esParte = true;
		Object unaParte;
		
		while ((iter.hasNext()) && (esParte)){
			unaParte = iter.next();
			if (!(unaParte instanceof Parte))
				esParte = false;
		}
		
		return esParte;
	}
	
	public ListaDePartes (ArrayList v){
		this.v = v;
	}

	public boolean add(Object arg0) {
		
		if (arg0 instanceof Parte){
			v.add(arg0);
			return true;
		}
			
		return false;
	}

	public void add(int arg0, Object arg1) {
		
		if (arg1 instanceof Parte){
			v.add(arg0,arg1);
		}
		
	}

	public boolean addAll(Collection arg0) {
		
		boolean tiene = tienePartes(arg0);
		
		if (tiene) 
			v.addAll(arg0);
		
		return tiene;
			
	}

	public boolean addAll(int arg0, Collection arg1) {
		return v.addAll(arg0, arg1);
	}

	public void clear() {
		v.clear();		
	}

	public boolean contains(Object o) {
		return v.contains(o);
	}

	public boolean containsAll(Collection arg0) {
		return v.containsAll(arg0);
	}

	public Object get(int index) {
		return v.get(index);
		
	}

	public int indexOf(Object o) {
		return v.indexOf(o);
	}

	public boolean isEmpty() {
		return v.isEmpty();
	}

	public Iterator iterator() {
		return v.iterator();
	}

	public int lastIndexOf(Object o) {
		return v.lastIndexOf(o);
	}

	public ListIterator listIterator() {
		// TODO Auto-generated method stub
		return null;
	}

	public ListIterator listIterator(int index) {
		// TODO Auto-generated method stub
		return null;
	}

	public boolean remove(Object o) {
		return v.remove(o);
	}

	public Object remove(int index) {
		return v.remove(index);
	}

	public boolean removeAll(Collection arg0) {
		return v.removeAll(arg0);
	}

	public boolean retainAll(Collection arg0) {
		return v.retainAll(arg0);
	}

	public Object set(int arg0, Object arg1) {
		return v.set(arg0, arg1);
	}

	public int size() {
		
		return v.size();
	}

	public List subList(int fromIndex, int toIndex) {
		
		return v.subList(fromIndex, toIndex);
	}

	public Object[] toArray() {
		
		return v.toArray();
	}

	public Object[] toArray(Object[] arg0) {
		return v.toArray(arg0);
	}
	
	
		
	
	 
	

}
